var btns = document.getElementsByTagName('li')
var cons = document.getElementsByClassName('con')

for(var i = 0; i < btns.length; i++){
	btns[i].index = i//给每个按钮都定义一个index
	btns[i].onclick = function(){
		//控制按钮的样式
		for(var j = 0; j < btns.length; j++){
			btns[j].className = ""
		}
		this.className = "active"
		//控制con的样式
		for(var k = 0; k < cons.length; k++){
			cons[k].style.display = "none"
		}
		cons[this.index].style.display = "block"
	}
}